////////////////////////////////////////////////////////////////////////////////
/// @file    sys.c
/// @author  AE TEAM
/// @brief   THIS FILE PROVIDES ALL THE SYSTEM FUNCTIONS.
////////////////////////////////////////////////////////////////////////////////
/// @attention
///
/// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
/// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
/// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
/// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
/// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
/// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
///
/// <H2><CENTER>&COPY; COPYRIGHT MINDMOTION </CENTER></H2>
////////////////////////////////////////////////////////////////////////////////

// Define to prevent recursive inclusion
#define _SYS_C_

// Files includes
#include "sys.h"

////////////////////////////////////////////////////////////////////////////////
/// @addtogroup MM32_Hardware_Abstract_Layer
/// @{

////////////////////////////////////////////////////////////////////////////////
/// @addtogroup SYS
/// @{

////////////////////////////////////////////////////////////////////////////////
/// @addtogroup SYS_Exported_Functions
/// @{
////////////////////////////////////////////////////////////////////////////////
/// @brief  The following method is adopted to implement assembly instruction WFI
/// @param  None.
/// @retval None.
////////////////////////////////////////////////////////////////////////////////

void WFI_SET(void)
{
    __ASM volatile("wfi");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief  Disable total interrupt
/// @param  None.
/// @retval None.
////////////////////////////////////////////////////////////////////////////////

void INTX_DISABLE(void)
{
    __ASM volatile("cpsid i");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief  Enable total interrupt
/// @param  None.
/// @retval None.
////////////////////////////////////////////////////////////////////////////////

void INTX_ENABLE(void)
{
    __ASM volatile("cpsie i");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief  Set the stack top address
/// @param  addr:top address
/// @retval None.
////////////////////////////////////////////////////////////////////////////////
__asm void MSR_MSP(u32 addr)
{
    MSR MSP, r0             //set Main Stack value
    BX r14
}

/// @}

/// @}

/// @}
